//
//  ViewController.m
//  UI18_StatusBar(状态栏)
//
//  Created by 李劲成 on 16/4/1.
//  Copyright © 2016年 ljc. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIButton *ButtonOfChange;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark - 知识点: 状态栏颜色
/** 重写方法. */
-(UIStatusBarStyle)preferredStatusBarStyle {
    if([self.ButtonOfChange isSelected]){

        return UIStatusBarStyleDefault;
    }
    else {
    // 亮色.
    return UIStatusBarStyleLightContent;
    }
}
- (IBAction)handleChangeStatusBar:(id)sender {
    
    UIButton *button = (UIButton *)sender;
    // 状态取反.
    button.selected = !button.selected;
    // 更改(更新)状态栏颜色
    [self setNeedsStatusBarAppearanceUpdate];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
